Create an employee
This request is used to create a record for a client's new employee.
Request syntax
POST https://b2b-api.go.yandex.ru/integration/2.0/users
Request headers
Authorization: Bearer <OAuth-token>
OAuth access token. The steps to get a token are described in Getting started.
X-YaTaxi-Selected-Corp-Client-Id— client ID from the account. Required if multiple clients are available using the token.
Request body
Data for the new employee is passed in the request body in JSON format:
| Field | Description | Format | Required |
|---|---|---|---|
fullname |
The employee's full name. Can be an empty string. | String | Yes |
phone |
The user's phone number. You can only specify a number in the international format with the country code, for example +79001234567. |
String | Yes |
email |
The user's email. You can only specify an email that follows the standard address format. | String | No |
is_active |
Indicates that the employee is active. An inactive employee can't place an order and rides can't be ordered in their name. | Logical | Yes |
cost_centers_id |
ID of the cost center. The field is required when creating a user. | String | Yes |
nickname |
The employee's short name. In the interface of the Corporate Client Dashboard, it is the ID field in the external system. | String | No |
department_id |
id of the employee's department in the interface of the Corporate Client Dashboard. | String | No |
limits |
The limits on the amount the employee can spend on services in a calendar month. | An array of elements that contains a separate element for each service. | No |
Structure of the limits array element:
|
Field |
Description |
Format |
Required |
|
|
The ID of a previously created limit. This ID will be assigned to a user. |
String |
Yes |
|
|
The service name. Acceptable values:
|
String |
Yes |
Response field description
The response with code 200 contains the following fields:
| Field | Description | Format |
|---|---|---|
id |
The employee's ID number. | String |
The response with code 400 contains the following fields:
| Field | Description | Format |
|---|---|---|
code |
Error code. | String |
message |
Error message. | String |
extra |
Additional information about the error. Optional. | Object |
Structure of the extra object:
|| Field | Description | Format ||
|| conflict_user_id | The ID of the user with whom the conflict occurred. The possible causes:
-
An existing user has that phone number.
-
An existing user has that email.
-
An existing user has that
nicknamefield value within the client. -
The uniqueness of other fields is disrupted. | String ||
|#
Request example
POST https://b2b-api.go.yandex.ru/integration/2.0/users
...
Authorization: Bearer <OAuth token>
{
"fullname": "Ilya Ivanov",
"phone": "+79990000000",
"is_active": true,
"nickname": "IIlya",
"cost_centers_id": "123...fef",
"department_id": "987...ghj",
"limits":[
{
"limit_id": "abcdef_taxi",
"service": "taxi"
},
{
"limit_id":"abcdef_eats",
"service":"eats2"
},
{
"limit_id":"abcdef_drive",
"service":"drive"
}
]
}
Response example
An example response with code 200 looks like this:
{
"id": "3caa...3b05e"
}
An example response with code 400 looks like this:
{
"code": "USER_IS_DELETED_ERROR",
"message": "user is deleted",
"extra": {
"conflict_user_id": "c3ad...89ad"
}
}
Response codes
The response to this request may contain the following standard HTTP codes:
-
200: Request completed successfully. -
400: An unknown parameter or a parameter with an invalid value was passed in the request. -
401: The OAuth token is incorrect. -
403: The client doesn't have sufficient rights to run this request:-
SELECT_CLIENT_HEADER_REQUIRED: the request did not pass the header
X-YaTaxi-Selected-Corp-Client-Id(returned if more than one client is available for the token). -
SELECTED_CLIENT_ACCESS_DENIED: the header
X-YaTaxi-Selected-Corp-Client-Idcontains the client's ID, which this login does not have access to.
-
-
406: A record with the specified parameters already exists.
when specified
combined service
the service is outdated, use eats2
Hotels